from Celery_phone import app
from ronglian_sms_sdk import SmsSDK
from utils.aliyun_sms_2017 import Sample
accId = '2c94811c8cd4da0a018ef44e2e2c6761'
accToken = 'edb255e23f3d49ca9bcb91caa0724355'
appId = '2c94811c8cd4da0a018ef44e2fbe6768'


@app.task
def send_sms(phone, code):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    datas = (code, 1)
    resp = sdk.sendMessage(tid, phone, datas)
    return resp


# aliyun 发送短信验证码
@app.task
def send_sms_aliyun(phone, code):
    samp = Sample()
    resp = samp.main(phone, code)
    return resp
